import request from '@/utils/request'
import { encryptionData } from '@/utils/com'
import Qs from 'qs'

/* 发票信息 */
export function getInvoice(data) {
  return request({
    url: '/jcdOrder/invoiceInfo/info',
    method: 'get',
    headers: encryptionData(data, '/invoiceInfo/info'),
    params: data
  })
}

/* 发票信息-保存 */
export function saveInvoice(data) {
  return request({
    url: '/jcdOrder/invoiceInfo/save',
    method: 'post',
    headers: encryptionData(data, '/invoiceInfo/save'),
    data: Qs.stringify(data)
  })
}

/* 应开/应开发票-列表 */
export function getInvoiceList(data) {
  return request({
    url: '/jcdOrder/paymentInvoice/page',
    method: 'get',
    headers: encryptionData(data, '/paymentInvoice/page'),
    params: data
  })
}

/* 发票详情 */
export function getInvoiceDetail(id, data) {
  return request({
    url: `/jcdOrder/paymentInvoice/invoiceDetail/${id}`,
    method: 'get',
    headers: encryptionData(data, `/paymentInvoice/invoiceDetail/${id}`),
    params: data
  })
}

/* 开票信息 */
export function getApplyInvoiceDetail(id, data) {
  return request({
    url: `/jcdOrder/paymentInvoice/getPayInvoiceInfo/${id}`,
    method: 'get',
    headers: encryptionData(data, `/paymentInvoice/getPayInvoiceInfo/${id}`),
    params: data
  })
}

/* 开票-保存 */
export function confrimApplyInvoice(data) {
  return request({
    url: '/jcdOrder/paymentInvoice/invoiceOrderSave',
    method: 'post',
    headers: encryptionData(data, '/paymentInvoice/invoiceOrderSave'),
    data: Qs.stringify(data)
  })
}

/* 申请开票-保存 */
export function applyInvoice(data) {
  return request({
    url: '/jcdOrder/paymentInvoice/invoiceConfirm',
    method: 'post',
    headers: encryptionData(data, '/paymentInvoice/invoiceConfirm'),
    data: Qs.stringify(data)
  })
}

/* 专票审核-列表 */
export function getSpecialAuditList(data) {
  return request({
    url: '/jcdOrder/specialInfo/page',
    method: 'get',
    headers: encryptionData(data, '/specialInfo/page'),
    params: data
  })
}

/* 专票审核-详情 */
export function getSpecialAuditDetail(data) {
  return request({
    url: '/jcdOrder/specialInfo/get',
    method: 'get',
    headers: encryptionData(data, '/specialInfo/get'),
    params: data
  })
}

/* 专票审核-添加 */
export function saveSpecialAudit(data) {
  return request({
    url: '/jcdOrder/specialInfo/save',
    method: 'post',
    headers: encryptionData(data, '/specialInfo/save'),
    data: Qs.stringify(data)
  })
}

/* 专票审核-修改 */
export function updateSpecialAudit(data) {
  return request({
    url: '/jcdOrder/specialInfo/update',
    method: 'post',
    headers: encryptionData(data, '/specialInfo/update'),
    data: Qs.stringify(data)
  })
}

/* 专票审核-审核 */
export function auditSpecialAudit(data) {
  return request({
    url: '/jcdOrder/specialInfo/checkInfo',
    method: 'post',
    headers: encryptionData(data, '/specialInfo/checkInfo'),
    data: Qs.stringify(data)
  })
}
